
<div id="container" style="margin:0 25px 5px; z-index:2;">
  <table cellpadding="3" cellspacing="0" border="0">
    <tr>
      <td valign="top">
        <div id="flashContent" style="margin-top:50px; font-size:15px;"><?php __('Photo viewer requires JavaScript and the Flash Player.'); ?> <a href="http://get.adobe.com/flashplayer/"><?php __('Get Flash'); ?></a></div>
      </td>
      <td valign="top" style="padding-left:15px;">
        <a href="http://twitter.com/carelatex/"><img src="<?php e($this->base); ?>/img/twitter.png" alt="Visit me on Twitter!" style="width:179px; float:none; display:block; border:0;" /></a>
        <div style="height:7px; background-color:#585B60;"></div>
        <div id="twitter" style="height:500px; overflow:auto;"></div>
        <img src="<?php e($this->base); ?>/img/twitter-footer.png" style="width:179px; float:none; display:block;" />
      </td>
    </tr>
  </table>
</div>

<script type="text/javascript">
var _webroot = '<?php e($this->base); ?>';

function init () {
    var flashvars = {};
    flashvars.xml = _webroot+'/images/slides/config.xml';
    flashvars.font = 'font.swf';
    var attributes = {};
    //attributes.wmode = 'transparent';
    attributes.bgcolor = 'DCDDDF';
    attributes.id = 'slider';
    swfobject.embedSWF(_webroot+'/img/slides/cu3er.swf', 'flashContent', '830', '567', '9', _webroot+'/img/slides/expressInstall.swf', flashvars, attributes);


    $.getJSON('http://twitter.com/status/user_timeline/carelatex.json?count=10&callback=?', function(data){
        $.each(data, function(index, item){
            $('#twitter').append('<div class="tweet"><p>' + item.text.linkify() + '</p><i>' + relative_time(item.created_at) + '</i></div>');
        });
    });

    String.prototype.linkify = function() {
        return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+/, function(m) {
            return m.link(m);
        });
    };
} // init

function relative_time (time_value) {
      var values = time_value.split(" ");
      time_value = values[1] + " " + values[2] + ", " + values[5] + " " + values[3];
      var parsed_date = Date.parse(time_value);
      var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
      var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
      delta = delta + (relative_to.getTimezoneOffset() * 60);

      var r = '';
      if (delta < 60) {
        r = 'a minute ago';
      } else if(delta < 120) {
        r = 'couple of minutes ago';
      } else if(delta < (45*60)) {
        r = (parseInt(delta / 60)).toString() + ' minutes ago';
      } else if(delta < (90*60)) {
        r = 'an hour ago';
      } else if(delta < (24*60*60)) {
        r = '' + (parseInt(delta / 3600)).toString() + ' hours ago';
      } else if(delta < (48*60*60)) {
        r = '1 day ago';
      } else {
        r = (parseInt(delta / 86400)).toString() + ' days ago';
      }

      return r;
} // relative_time

<?php $this->addScript('Ext.onReady(function() { init(); });'); ?>
</script>